/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package View;
import java.awt.Dimension;
import java.awt.Toolkit;

/**
 *
 * @author root
 */
public class FormUtama extends javax.swing.JFrame {
    public static FormManageUser formManageUser = new FormManageUser ();
    public static FormOperator formOperator = new FormOperator ();
    public static FormForklift formForklift = new FormForklift ();
    public static FormHelper formHelper = new FormHelper ();
    public static FormTransaksi formTransaksi = new FormTransaksi ();

    /**
     * Creates new form FormUtama
     */
    public FormUtama() {
        initComponents();
        Dimension dimensi = Toolkit.getDefaultToolkit().getScreenSize();
        setSize((int)(0.8*dimensi.width),(int)(0.8*dimensi.height));
        setLocation(dimensi.width/2-getWidth()/2,dimensi.height/2-getHeight()/2);
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        formUtamaDesktopPane = new javax.swing.JDesktopPane();
        formUtamaMenuBar = new javax.swing.JMenuBar();
        fileMenu = new javax.swing.JMenu();
        manageUserMenuItem = new javax.swing.JMenuItem();
        keluarMenuItem = new javax.swing.JMenuItem();
        masterDataMenu = new javax.swing.JMenu();
        forkliftMenuItem = new javax.swing.JMenuItem();
        transaksiMenuItem = new javax.swing.JMenuItem();
        operatorMenuItem = new javax.swing.JMenuItem();
        helperMenuItem = new javax.swing.JMenuItem();
        transaksiMenu = new javax.swing.JMenu();
        perJamMenuItem = new javax.swing.JMenuItem();
        harianMenuItem = new javax.swing.JMenuItem();
        bulananMenuItem = new javax.swing.JMenuItem();
        laporanMenu = new javax.swing.JMenu();
        laporanSPKMenuItem = new javax.swing.JMenuItem();
        laporanBulananMenuItem = new javax.swing.JMenuItem();
        penggajianMenuItem = new javax.swing.JMenuItem();
        helpMenu = new javax.swing.JMenu();
        aboutMenuItem = new javax.swing.JMenuItem();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Kianis Pratama");
        setBounds(new java.awt.Rectangle(100, 100, 0, 0));
        setPreferredSize(new java.awt.Dimension(800, 600));

        fileMenu.setText("File");

        manageUserMenuItem.setText("Manage User");
        manageUserMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                manageUserMenuItemActionPerformed(evt);
            }
        });
        fileMenu.add(manageUserMenuItem);

        keluarMenuItem.setText("Keluar");
        keluarMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                keluarMenuItemActionPerformed(evt);
            }
        });
        fileMenu.add(keluarMenuItem);

        formUtamaMenuBar.add(fileMenu);

        masterDataMenu.setText("Master Data");

        forkliftMenuItem.setText("Forklift");
        forkliftMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                forkliftMenuItemActionPerformed(evt);
            }
        });
        masterDataMenu.add(forkliftMenuItem);

        transaksiMenuItem.setText("Transaksi");
        transaksiMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                transaksiMenuItemActionPerformed(evt);
            }
        });
        masterDataMenu.add(transaksiMenuItem);

        operatorMenuItem.setText("Operator");
        operatorMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                operatorMenuItemActionPerformed(evt);
            }
        });
        masterDataMenu.add(operatorMenuItem);

        helperMenuItem.setText("Helper");
        helperMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                helperMenuItemActionPerformed(evt);
            }
        });
        masterDataMenu.add(helperMenuItem);

        formUtamaMenuBar.add(masterDataMenu);

        transaksiMenu.setText("Transaksi");

        perJamMenuItem.setText("per-Jam");
        transaksiMenu.add(perJamMenuItem);

        harianMenuItem.setText("Harian");
        transaksiMenu.add(harianMenuItem);

        bulananMenuItem.setText("Bulanan");
        transaksiMenu.add(bulananMenuItem);

        formUtamaMenuBar.add(transaksiMenu);

        laporanMenu.setText("Laporan");

        laporanSPKMenuItem.setText("Laporan SPK");
        laporanMenu.add(laporanSPKMenuItem);

        laporanBulananMenuItem.setText("Laporan Bulanan");
        laporanMenu.add(laporanBulananMenuItem);

        penggajianMenuItem.setText("Penggajian");
        laporanMenu.add(penggajianMenuItem);

        formUtamaMenuBar.add(laporanMenu);

        helpMenu.setText("Help");

        aboutMenuItem.setText("About");
        helpMenu.add(aboutMenuItem);

        formUtamaMenuBar.add(helpMenu);

        setJMenuBar(formUtamaMenuBar);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(formUtamaDesktopPane, javax.swing.GroupLayout.DEFAULT_SIZE, 400, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(formUtamaDesktopPane, javax.swing.GroupLayout.DEFAULT_SIZE, 277, Short.MAX_VALUE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void manageUserMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_manageUserMenuItemActionPerformed
        // TODO add your handling code here:
        if (formManageUser.isVisible()) {
            try { formManageUser.setSelected(true); }
            catch (Exception ex) { }
        }
        else {
            formManageUser = new FormManageUser();
            formUtamaDesktopPane.add(formManageUser);
            formManageUser.setVisible(true);
        }
    }//GEN-LAST:event_manageUserMenuItemActionPerformed

    private void keluarMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_keluarMenuItemActionPerformed
        // TODO add your handling code here:
        System.exit(0);
    }//GEN-LAST:event_keluarMenuItemActionPerformed

    private void operatorMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_operatorMenuItemActionPerformed
        // TODO add your handling code here:
        if (formOperator.isVisible()) {
            try { formOperator.setSelected(true); }
            catch (Exception ex) { }
        }
        else {
            formOperator = new FormOperator();
            formUtamaDesktopPane.add(formOperator);
            formOperator.setVisible(true);
        }
    }//GEN-LAST:event_operatorMenuItemActionPerformed

    private void forkliftMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_forkliftMenuItemActionPerformed
        // TODO add your handling code here:
         if (formForklift.isVisible()) {
            try { formForklift.setSelected(true); }
            catch (Exception ex) { }
        }
        else {
            formForklift = new FormForklift();
            formUtamaDesktopPane.add(formForklift);
            formForklift.setVisible(true);
        }
    }//GEN-LAST:event_forkliftMenuItemActionPerformed

    private void helperMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_helperMenuItemActionPerformed
        // TODO add your handling code here:
        if (formHelper.isVisible()) {
            try { formHelper.setSelected(true); }
            catch (Exception ex) { }
        }
        else {
            formHelper = new FormHelper();
            formUtamaDesktopPane.add(formHelper);
            formHelper.setVisible(true);
        }
    }//GEN-LAST:event_helperMenuItemActionPerformed

    private void transaksiMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_transaksiMenuItemActionPerformed
        // TODO add your handling code here:
        if (formTransaksi.isVisible()) {
            try { formTransaksi.setSelected(true); }
            catch (Exception ex) { }
        }
        else {
            formTransaksi = new FormTransaksi();
            formUtamaDesktopPane.add(formTransaksi);
            formTransaksi.setVisible(true);
        }
    }//GEN-LAST:event_transaksiMenuItemActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /*
         * Set the Nimbus look and feel
         */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /*
         * If Nimbus (introduced in Java SE 6) is not available, stay with the
         * default look and feel. For details see
         * http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(FormUtama.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(FormUtama.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(FormUtama.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(FormUtama.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /*
         * Create and display the form
         */
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new FormUtama().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JMenuItem aboutMenuItem;
    private javax.swing.JMenuItem bulananMenuItem;
    private javax.swing.JMenu fileMenu;
    private javax.swing.JMenuItem forkliftMenuItem;
    private javax.swing.JDesktopPane formUtamaDesktopPane;
    private javax.swing.JMenuBar formUtamaMenuBar;
    private javax.swing.JMenuItem harianMenuItem;
    private javax.swing.JMenu helpMenu;
    private javax.swing.JMenuItem helperMenuItem;
    private javax.swing.JMenuItem keluarMenuItem;
    private javax.swing.JMenuItem laporanBulananMenuItem;
    private javax.swing.JMenu laporanMenu;
    private javax.swing.JMenuItem laporanSPKMenuItem;
    private javax.swing.JMenuItem manageUserMenuItem;
    private javax.swing.JMenu masterDataMenu;
    private javax.swing.JMenuItem operatorMenuItem;
    private javax.swing.JMenuItem penggajianMenuItem;
    private javax.swing.JMenuItem perJamMenuItem;
    private javax.swing.JMenu transaksiMenu;
    private javax.swing.JMenuItem transaksiMenuItem;
    // End of variables declaration//GEN-END:variables
}
